// https://lbs.amap.com/api/javascript-api-v2/documentation#marker
export interface MapMarkerOption {
	position: [number, number];
	icon?: string;
	content?: string | HTMLElement;
	title?: string;
	visible?: boolean;
	zIndex?: number;
	offset?: [number, number];
	anchor?: 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
	angle?: number;
	clickable?: boolean;
	draggable?: boolean;
	bubble?: boolean;
	zooms?: [number, number];
	cursor?: 'pointer';
	topWhenClick?: boolean;
	height?: number;
	label?: {
		content: string;
		offset: [number, number];
		direction: 'top' | 'right' | 'bottom' | 'left' | 'center';
	};
	extData?: Record<string, any>;
}

// https://lbs.amap.com/api/javascript-api-v2/documentation#polyline
export interface MapPolylineOption {
	path: [number, number][];
	zIndex?: number;
	bubble?: boolean;
	cursor?: boolean;
	strokeColor?: string;
	strokeOpacity?: number;
	strokeWeight?: number;
	strokeStyle?: 'solid' | 'dashed';
	strokeDasharray?: number[];
	lineJoin?: 'miter' | 'round' | 'bevel';
	lineCap?: 'butt' | 'round' | 'square';
	geodesic?: boolean;
	showDir?: boolean;
	isOutline?: boolean;
	borderWeight?: number;
	outlineColor?: string;
	draggable?: boolean;
	height?: number;
	extData?: Record<string, any>;
}

// https://lbs.amap.com/api/javascript-api-v2/documentation#polygon
export interface MapPolygonOption {
	// 多边形轮廓线的节点坐标数组。 支持 单个普通多边形({Array })，单个带孔多边形({Array<Array >})，多个带孔多边形({Array<Array<Array >>})
	path: [number, number][] | [number, number][][] | [number, number][][][];
	zIndex?: number;
	bubble?: boolean;
	cursor?: boolean;
	strokeColor?: string;
	strokeOpacity?: number;
	strokeWeight?: number;
	strokeStyle?: 'solid' | 'dashed';
	strokeDasharray?: number[];
	fillColor?: string;
	fillOpacity?: number;
	draggable?: boolean;
	height?: number;
	extrusionHeight?: number;
	wallColor?: string[] | string;
	roofColor?: string[] | string;
	extData?: Record<string, any>;
}

// https://lbs.amap.com/api/javascript-api-v2/documentation#markercluster
export interface MapMarkerClusterOption {
	gridSize?: number;
	maxZoom?: number;
	averageCenter?: boolean;
	clusterByZoomChange?: boolean;
	styles?: Array<{
		url: string;
		size: number;
		offset: [number, number];
		imageOffset: [number, number];
		textColor: string;
		textSize: number;
	}>;
	renderClusterMarker?: (data: any) => void;
	renderMarker?: (data: any) => void;
}

export interface MapProvider {
	onLoaded: (cb: (load: boolean) => void) => void;
	drawMarker: (options: MapMarkerOption, cb?: (marker: any) => void) => void;
	drawPolyline: (options: MapPolylineOption, cb?: (marker: any) => void) => void;
	drawPolygon: (options: MapPolygonOption, cb?: (marker: any) => void) => void;
	drawMarkerCluster: (
		dataOptions: Array<{ lnglat: [number, number][]; weight?: number }>,
		options: MapMarkerClusterOption,
		cb?: (marker: any) => void
	) => void;
}
